﻿using Microsoft.ApplicationServer.Caching;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Blogger.UI.Controllers
{


    public class HomeController : UIController
    {
      
        public HomeController()
        {
            
        }
        public ActionResult Index()
        {
           

            return View();
        }
        public ActionResult SessionData()
        {
            //ViewBag.ApplicationName =  myCache["ApplicationName"] as string;
            // ViewBag.UserName = myCache["UserName"] as string;
            // ViewBag.ControllerName = myCache["ControllerName"] as string;

            return View();
        }
        public ActionResult About()
        {
            DataCache dataCache = null;
            try
            {
                DataCacheFactory factory = new DataCacheFactory();
                dataCache = factory.GetDefaultCache();
            }
            catch (Exception dfd)
            {
            }
            try
            {
                dataCache["ApplicationName"] = "MyWeb Application";
                dataCache["UserName"] = "Pijush Biswas";
                dataCache["ControllerName"] = "Home";
                ViewBag.Cache = dataCache;
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex;
            }
            Session["ApplicationName"] = "MyWeb Application";
            Session["UserName"] = "Pijush Biswas";
            Session["ControllerName"] = "Home";
            return View();
        }
        [HttpPost]
        public ActionResult SessionData(FormCollection forms)
        {
            Session["ApplicationName"] = forms["ApplicationName"];
            Session["UserName"] = forms["UserName"];
            Session["ControllerName"] = forms["ControllerName"];


           // myCache["ApplicationName"] = forms["ApplicationName"];
           // myCache["UserName"] = forms["UserName"];
           // myCache["ControllerName"] = forms["ControllerName"];

            return View();
        }       

    }
    
}
